<!-- 代办事项 -->
<template>
	<view class="agency">
		<div class="one">
			{{ currentYear }}-{{ currentMonth }}-{{ currentDay }}
		</div>
		
		<div class="two" v-for="item,index in list" :key="item.id">
			<div class="list" v-if="list[index].status == '1'">
				<div class="left" @click="add(item)">
					<image src="../../../static/diImage/待跟进任务.png" mode=""></image>
					<div class="p">待跟进任务</div>
				</div>
				<div class="right" @click="task">
					10<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			
			<div class="list" v-else-if="list[index].status == '2'">
				<div class="left" @click="add(item)">
					<image src="../../../static/diImage/待回款计划.png" mode=""></image>
					<div class="p">待回款计划</div>
				</div>
				<div class="right" @click="returned">
					10<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<div class="list" v-else-if="list[index].status == '3'">
				<div class="left" @click="add(item)">
					<image src="../../../static/diImage/待处理工单.png" mode=""></image>
					<div class="p">待处理工单</div>
				</div>
				<div class="right" @click="work">
					10<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<div class="list" v-else-if="list[index].status == '4'">
				<div class="left" @click="add(item)">
					<image src="../../../static/diImage/待处理日程.png" mode=""></image>
					<div class="p">待处理日程</div>
				</div>
				<div class="right" @click="processingSchedule">
					10<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<div class="list" v-else-if="list[index].status == '5'">
				<div class="left" @click="add(item)">
					<image src="../../../static/diImage/待处理任务.png" mode=""></image>
					<div class="p">待处理任务</div>
				</div>
				<div class="right" @click="dispose">
					10<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			
			<div class="list" v-else-if="list[index].status == '6'">
				<div class="left" @click="add(item)">
					<image src="../../../static/diImage/待审批订单.png" mode=""></image>
					<div class="p">待审批订单</div>
				</div>
				<div class="right" @click="order">
					10<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<div class="list" v-else-if="list[index].status == '7'">
				<div class="left" @click="add(item)">
					<image src="../../../static/diImage/待审批回款.png" mode=""></image>
					<div class="p">待审批回款</div>
				</div>
				<div class="right" @click="collect">
					10<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<div class="list" v-else-if="list[index].status == '8'">
				<div class="left" @click="add(item)">
					<image src="../../../static/diImage/待审批报销.png" mode=""></image>
					<div class="p">待审批报销</div>
				</div>
				<div class="right" @click="apply">
					10<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<div class="list" v-else-if="list[index].status == '9'">
				<div class="left" @click="add(item)">
					<image src="../../../static/diImage/待审批办公.png" mode=""></image>
					<div class="p">待审批办公</div>
				</div>
				<div class="right"  @click="office">
					10<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
		</div>
		<div class="three" style="height: 80rpx;"></div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				currentDate: new Date(),
			}
		},
		methods: {
			// 跳转到详情
			add(item){
				uni.navigateTo({
				  url:
				    "/pages/di/cheduleDetails/cheduleDetails?item=" +
				    JSON.stringify(item),
				});
			},
			// 待跟进任务
			task(){
				uni.navigateTo({
					url:'/pages/di/task/task'
				})
			},
			// 待回款计划
			returned(){
				uni.navigateTo({
					url:'/pages/di/returned/returned'
				})
			},
			// 待处理工单
			work(){
				uni.navigateTo({
					url:'/pages/office_gongdan/office_gongdan'
				})
			},
			// 待处理日程
			processingSchedule(){
				uni.navigateTo({
					url:'/pages/di/processingSchedule/processingSchedule'
				})
			},
			// 待处理任务
			dispose(){
				uni.navigateTo({
					url:'/pages/di/dispose/dispose'
				})
			},
			// 待审批订单
			order(){
				uni.navigateTo({
					url:'/pages/office_shenpi_dingdan/office_shenpi_dingdan'
				})
			},
			// 待审批回款
			collect(){
				uni.navigateTo({
					url:'/pages/office_shenpi_huikuan/office_shenpi_huikuan'
				})
			},
			// 待审批报销
			apply(){
				uni.navigateTo({
					url:'/pages/office_shenpi_baoxiao/office_shenpi_baoxiao'
				})
			},
			// 待审批办公
			office(){
				uni.navigateTo({
					url:'/pages/di/office/office'
				})
			},
		},
		  computed: {
		    // 获取	当前是那一天
		    currentDay() {
		      return this.currentDate.getDate();
		    },
		    // 获取当前是第几月
		    currentMonth() {
		      return this.currentDate.getMonth() + 1;
		    },
		    // 获取当前是哪一年
		    currentYear() {
		      return this.currentDate.getFullYear();
		    },
		  },
		  created() {
		    uni.request({
		      url: "http://127.0.0.1:3000/salesLead/getAll", //接口地址
		      method: "POST",
		      success: (res) => {
		        this.list = res.data.data;
		        console.log(this.list);
		      },
		    });
		  },
	}
</script>

<style lang="scss">
.agency{
	width: 100%;
	height: 100%;
	padding: 20rpx;
	.one{
		width: 100%;
		height: 100rpx;
		display: flex;
		align-items: center;
	}
	
	.list{
		width: 100%;
		height: 140rpx;
		padding: 20rpx;
		display: flex;
		border: 1rpx solid gainsboro;
		border-radius: 20rpx;
		justify-content: space-between;
		margin-bottom: 20rpx;
		.left{
			display: flex;
			align-items: center;
		}
		.right{
			display: flex;
			align-items: center;
		}
	}
	image{
		width: 80rpx;
		height: 80rpx;
		margin-right: 20rpx;
	}
}
</style>
